using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class VitalSignMap : EntityTypeConfiguration<VitalSign>
	{
		public VitalSignMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.BMI)
				.HasMaxLength(50);
				
			this.Property(t => t.Pain)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("VitalSigns");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.EpisodeDoctorRelId).HasColumnName("EpisodeDoctorRelId");
			this.Property(t => t.VitalSignDate).HasColumnName("VitalSignDate");
			this.Property(t => t.BodyTem).HasColumnName("BodyTem");
			this.Property(t => t.Pulse).HasColumnName("Pulse");
			this.Property(t => t.Systolic).HasColumnName("Systolic");
			this.Property(t => t.Destolic).HasColumnName("Destolic");
			this.Property(t => t.RespiratoryRate).HasColumnName("RespiratoryRate");
			this.Property(t => t.OxigenSatulation).HasColumnName("OxigenSatulation");
			this.Property(t => t.Height).HasColumnName("Height");
			this.Property(t => t.Weight).HasColumnName("Weight");
			this.Property(t => t.BMI).HasColumnName("BMI");
			this.Property(t => t.Pain).HasColumnName("Pain");
			this.Property(t => t.RecordTime).HasColumnName("RecordTime");
			this.Property(t => t.RecordStatus).HasColumnName("RecordStatus");

			// Relationships
			this.HasOptional(t => t.EpisodeDoctorRel)
				.WithMany(t => t.VitalSigns)
				.HasForeignKey(d => d.EpisodeDoctorRelId);
				
		}
	}
}

